package debugs;

import java.lang.reflect.*;

import javax.servlet.http.HttpServletResponse;

import entities.Staff;

public class StaffDebug {
	public static void debug(Staff staff) {
		try {
			System.out.println("-------------------------------------------------------------");
			for (Field f : staff.getClass().getDeclaredFields()) {
				f.setAccessible(true);
				System.out.print(f.getName());
				System.out.print(": ");
				System.out.print(f.get(staff));
				System.out.println("");
			}
			System.out.println("-------------------------------------------------------------");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static void debugWeb(Staff staff, HttpServletResponse response) {
		try {
			response.getWriter().println("-------------------------------------------------------------");
			for (Field f : staff.getClass().getDeclaredFields()) {
				f.setAccessible(true);
				response.getWriter().print(f.getName());
				response.getWriter().print(": ");
				response.getWriter().print(f.get(staff));
				response.getWriter().println("");
			}
			response.getWriter().println("-------------------------------------------------------------");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
